<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <div :style="s"></div>
    <input type="button" value="修改" @click="changeFn">

    <!-- 一、style属性的加强 -->
    <!-- 1、style属性的值可以是对象 -->
    <div :style="sObj1"></div>
    <input type="button" value="长长" @click="zhangChang">
    <div :style="{width:w+'px',height:h+'px',backgroundColor:color}"></div>
    <input type="button" value="长长02" @click="zhangChang02">

    <!-- 2、style属性的值可以是数组 -->
    <div :style="[size,border]"></div>
    <input type="button" value="长长03" @click="zhangChang03">

    <!-- 二、class属性的加强 -->
    <!-- 1、class属性的取值可以是对象 -->
    <div></div>
    <!-- 2、class属性的取值可以是数组 -->
  </div>
  <script src="./js/vue.js"></script>
  <script>
    let vm = new Vue({
      el: "#app",
      data: {
        s: "width:50px;height:50px;background-color:red",
        sObj1: {
          width: "50px",
          height: "50px",
          backgroundColor: "skyblue"
        },
        w: 50,
        h: 50,
        color: "orange",
        size: {
          width: "50px",
          height: "50px"
        },
        border: {
          border: "1px solid black"
        }
      },
      methods: {
        changeFn() {
          this.s = "width:100px;height:50px;background-color:red";
        },
        zhangChang() {
          this.sObj1.width = "100px"
        },
        zhangChang02() {
          this.w += 10;
        },
        zhangChang03() {
          this.size.width = "100px"
        }
      },
    })
  </script>
</body>

</html>